home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / MATHEMAT / 1769.ZIP / ALGIN2 < prev    next >
Text File  |  1987-02-21  |  758b  |  27 lines

  1. order x y z
  2. *  This example contains a procedure which computes factorials.
  3. *  The lines from "procedure factorial" to "return" define the
  4. *  procedure.  There is no provision for local variables or
  5. *  sums in procedures.  The sum "facarg" is used to
  6. *  transmit the argument, and the sum "facans" is used to
  7. *  transmit the answer.
  8. procedure factorial
  9. np=0     ;After this command only error messages are printed.
  10. define one=1
  11. define facans=one
  12. if facarg.eq.one goto facend
  13. define temp=facarg
  14. if temp.lt.one bomb
  15. label fact1
  16. compute facans=facans*temp
  17. compute temp=temp-one
  18. if temp.ne.one goto fact1
  19. label facend
  20. np=2     ;after this command the usual printing resumes
  21. return
  22.  
  23. define facarg=5
  24. call factorial
  25. print facans
  26. end input
  27.